﻿using System;
using System.Collections.Generic;
using System.Text;
using System.IO.Ports;
using System.Xml.Serialization;

namespace Scpi.Core.Business
{
    public interface ICommunicationParam
    {
        string GetURI();
    }
    [XmlInclude(typeof(NetWorkCommunicationParam))]
    [Serializable]
    public abstract class ComunicationParam : ICommunicationParam
    {
        public abstract string GetURI();
    }
    [Serializable]
    public sealed class NetWorkCommunicationParam: ComunicationParam
    {
        public string IpAddress { get; set; }
        public int Port { get; set; }

        public override string GetURI()
        {
            return IpAddress;
        }
    }
    [Serializable]
    public sealed class TtysComunicationParam: ComunicationParam
    {
        public string PortName { get; set; }
        public int Baudrate { get; set; }
        public StopBits StopBits { get; set; }
        public int DataBits { get; set; }
        public Parity CheckSum { get; set; }

        public override string GetURI()
        {
            return $"{PortName}";
        }
    }
}
